﻿@using Topro.Entity.Response.Menu
@using Topro.Entity.Enum

@model Topro.Entity.PagedList<MenuQueryResponse>
<div class="data-body data-scroll">
    <div class="data-view">
        <div class="data-div-view table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <th class="t_l">名称</th>
                        <th width="100">排放</th>
                        <th width="100">状态</th>
                        <th width="120">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.TData != null && Model.TData.Any())
                    {
                        foreach (var item in (IEnumerable<MenuQueryResponse>)Model.TData)
                        {
                    <tr>
                        <td class="t_l">@(item.Name)</td>
                        <td width="100">@(item.DisplayOrder)</td>
                        <td width="100">
                            @(item.Status == (sbyte)MenuStatus.启用 ? Html.Raw("<span class='green bold'>启用</span>") : Html.Raw("<span class='red bold'>禁用</span>"))
                        </td>
                        <td width="120">
                            @if (item.Status == (sbyte)MenuStatus.启用)
                            {
                                <a class="btn btn-danger btn-xs" data-confirm="确定要禁用该权限？" data-succesFun="doSearch" data-href="/Auth/UpdateMenuStatus?id=@(item.Id)&status=@((sbyte)MenuStatus.禁用)">禁用</a>
                            }
                            else
                            {
                                <a class="btn btn-primary btn-xs" data-confirm="确定要启用该权限？" data-succesFun="doSearch" data-href="/Auth/UpdateMenuStatus?id=@(item.Id)&status=@((sbyte)MenuStatus.启用)">启用</a>
                            }
                            <button type="button" class="btn btn-default btn-xs" data-modal="/Auth/ChildMenuAddOrEdit/@(item.Id)?parentId=@(item.ParentId)" data-title="编辑" data-width="600" data-height="500">
                                <span class="glyphicon glyphicon-edit"></span> 编辑
                            </button>
                        </td>
                    </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="4" class="t_c">暂无记录</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 必要的分页参数设置 -->
<input type="hidden" id="TotalCount" value="@(Model != null ? Model.TotalCount : 0)" />